import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ProductComponent } from './product.component';
import { CartComponent } from './components/cart/cart.component';
import { PcontentComponent } from './components/pcontent/pcontent.component';
import { PlistComponent } from './components/plist/plist.component';


const routes: Routes = [
  {
    path: '',
    component: ProductComponent,
    children: [   // 要想访问cart组件必须在html文件中输入router-outlet
      {
        path: 'cart',
        component: CartComponent
      },
      {
        path: 'pcontent',
        component: PcontentComponent
      }
    ]
  },
  {
    path: 'plist',
    component: PlistComponent
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class ProductRoutingModule { }
